
<div class="fadeIn">
    <br>
    <ol class="breadcrumb">
        <li class="active"><span class="glyphicon glyphicon-home" style="color:#23527c"></span>&nbsp;<mainpage></mainpage></li>
        <li class="active">系统管理 / 角色管理</li>
    </ol>
    <div class="marT15 marB15 clearfix">
        
            <div class="left marR10">
                <span class="search-name">角色名称：</span>
                <input type="text" class="form-control1" placeholder="" 
                ng-keyup='search($event)'
                ng-model="searchData.roleName">
            </div>
       
        <button class="btn btn-sm btn-primary" id="search" ng-click='search()'><span class="glyphicon glyphicon-search"></span></button>
        </div>
    <div class="row">
    </div>

   <div class="table-box">

    <table class="table table-bordered table-striped text-center bg-info">
        <thead >
        <tr class="info">
            <th class="text-center">序号</th>
            <th class="text-center">角色ID</th>
            <th class="text-center">角色名称</th>
            <th class="text-center">角色状态</th>
            <th class="text-center">数据访问权限</th>
            <th class="text-center">角色说明</th>
            <th class="text-center">操作</th>
        </tr>
        </thead>
        <tbody class="rolemanage">
        <tr ng-repeat="item in result">
            <td>{{$index+1}}</td>
            <td class="w70">{{item.roleId}}</td>
            <td class="w85">{{item.roleName}}</td>
            <td class="w85"><p ng-if='"1"==item.status' >有效</p>
                <p ng-if='"0"==item.status' >失效</p>
            </td>
            <td class="w115">{{item.acsFlagStr}}</td>
            <td style="min-width: 200px; word-break: break-all;">{{item.remark}}</td>
            <td style="min-width: 200px;"><a  class="marR10"  data-toggle="modal" data-target="#cop" ng-click="editTr('修改',item.roleId)">修改</a>
            <a  class="marR10"  data-toggle="modal" data-target="#myModal" ng-click="queData(item.roleId,item.acsFlag)">权限设置</a>

                <a class="marR10"
                   ng-click='changeStstus($index,item.roleId ,item.status)'
                   ng-show="'0'===item.status">有效</a>
                <a class="marR10"
                   ng-click='changeStstus($index,item.roleId ,item.status)'
                   ng-show="'1'===item.status">失效</a>
                <a class="marR10" data-toggle="modal" data-target="#delete" ng-click='delete(item.roleId,$index)'>删除</a></td>
        </tr>
        <tr>
            <td><a class="glyphicon glyphicon-plus"  type="button" data-toggle="modal" data-target="#cop" ng-click="editTr('添加')"></a></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
        </tr>
        </tbody>
    </table>
    </div>


    <div class="flip">
        <page></page>
    </div>
</div>
<!--添加或修改-->
<div class="modal fade " id="cop" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel">
    <div class="modal-dialog " role="document" style="width: 602px">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" >{{popup}}角色信息</h4>
            </div>
            <div class="modal-body">
                    <div class="row">
                        <div class="col-xs-6 lineH25">
                            <label class="left">角色ID：</label>
                            <input type="text" class="form-control right line4  rolename" placeholder="" ng-model="addData.roleId">
                        </div>
                        <div class="col-xs-6 lineH25">
                            
                                <label class="left">角色名称：</label>
                                <input type="text" class="form-control right line4 rolename" placeholder="" ng-model="addData.roleName">
                            
                        </div>
                    </div>
                    <br>
                    <div class="row">
                        <div class="col-xs-6">
                            <label class="left">角色状态：</label>
                            <select class="form-control right line4 rolestate" ng-model="addData.status">
                                <option value="1">生效</option>
                                <option value="0">失效</option>
                            </select>
                        </div>
                        <div class="col-xs-6">
                            <label class="left">数据访问权限：</label>
                            <select class="form-control line4 right rolestate" ng-model="addData.acsFlag">
                                <option value="0">本单位数据</option>
                                <option value="1">所有数据</option>
                            </select>
                        </div>
                    </div>
                    <br>

                    <div class="row">
                      <div class="col-xs-12">
                          <p><label>角色说明：</label></p>
                        <textarea class="form-control" ng-model="addData.remark"></textarea>
                      </div>
                        
                    </div>
                    <br>

                </form>

            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                <button type="button" class="btn btn-primary" ng-click='editSave()' >保存</button>
            </div>


        </div>
    </div>
</div>
<!--权限设置-->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="myModalLabel">权限设置</h4>
            </div>
            <div class="modal-body bg-info">
                <div class="row " >
                    <div class="col-md-7">
                            <h4>
                                角色功能权限设置
                            </h4>

                       <div id="treeBox">
                           <ul id="treeDemo" class="ztree"></ul>
                        </div>


                    </div>
                    <div class="col-md-5">
                        <h4>
                            角色数据访问权限设置
                        </h4>
                        <div class="radio">
                            <label>
                                <input type="radio" name="optionsRadios"  value="1" ng-model='flag'>
                                所有数据
                            </label>
                        </div>
                        <div class="radio">
                            <label>
                                <input type="radio" name="optionsRadios"  value="0" ng-model='flag'>
                                本单位数据
                            </label>
                        </div>
                    </div>
                </div>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                <button type="button" class="btn btn-primary" ng-click="auesave()">保存</button>
            </div>
        </div>
    </div>
</div>
<!--删除-->
<div class="modal fade" id="delete">
    <div class="modal-dialog">
        <div class="modal-content message_align">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
                <h4 class="modal-title">提示信息</h4>
            </div>
            <div class="modal-body">
                <p>删除角色存在用户权限风险，您确认删除吗？</p>
            </div>
            <div class="modal-footer">
                <input type="hidden" id="url"/>
                <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                <a  class="btn btn-primary" data-dismiss="modal" ng-click="deleteTr()">确定</a>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
</div>
<!-- 加载框 -->
  <span class='loaded' ng-show='loaded'><img  src="img/load.gif"></span>
<!-- 加载框 完成-->